﻿
using LIMS.Entities;
using Castle.Core.Logging;

namespace LIMS.DataAccess
{
    /// <summary>
    /// Exposes access to NHibernate DAO classes.  Motivation for this DAO
    /// framework can be found at http://www.hibernate.org/328.html.
    /// </summary>
    public class DaoFactory : IDaoFactory
    {
        public DaoFactory(string sessionFactoryConfigPath, ILogger oLogger)
        {
            SessionFactoryConfigPath = sessionFactoryConfigPath;
            this.logger = oLogger;
        }

        protected string SessionFactoryConfigPath
        {
            get
            {
                return sessionFactoryConfigPath;
            }
            set
            {
                sessionFactoryConfigPath = value;
            }
        }

        public IUserDao GetUserDao()
        {
            return new UserDao(sessionFactoryConfigPath,logger );
        }

        public IGroupDAO GetGroupDao()
        {
            return new GroupDAO(sessionFactoryConfigPath,logger);
        }

        public IUserGroupLinkDAO GetUserGroupLinkDAO()
        {
            return new UserGroupLinkDAO(sessionFactoryConfigPath, logger);
        }
      

        public IGroupPermissionLinkDao GetGroupPermissionLinkDao()
        {
            return new GroupPermissionLinkDao(sessionFactoryConfigPath, logger);
        }

        public ISiteDAO GetSiteDAO()
        {
            return new SiteDAO(sessionFactoryConfigPath, logger);
        }

        public IPlantDAO GetPlantDAO()
        {
            return new PlantDAO(sessionFactoryConfigPath, logger);
        }

        public IDepartmentDAO GetDepartmentDAO()
        {
            return new DeparmentDAO(sessionFactoryConfigPath, logger);
        }

        public IHeadDAO GetHeadDAO()
        {
            return new HeadsDAO(sessionFactoryConfigPath, logger);
        }

        public IProductDAO GetProductDAO()
        {
            return new ProductDAO(sessionFactoryConfigPath, logger);
        }

        public IAuditTrailDAO GetAuditTrailDAO()
        {
            return new AuditTrailDAO(sessionFactoryConfigPath, logger);
        }
        public IUserTypePermissionDAO GetUserTypePermissionDAO()
        {
            return new UserTypePermissionDAO(sessionFactoryConfigPath, logger);
        }
        public IProductHistoryDAO GetProductHistoryDAO()
        {
            return new ProductHistoryDAO(sessionFactoryConfigPath, logger);
        }

        public ISupplierDAO GetSupplierDAO()
        {
            return new SupplierDAO(sessionFactoryConfigPath, logger);
        }
        public IManufacturersDAO GetManufacturersDAO()
        {
            return new ManufacturersDAO(sessionFactoryConfigPath, logger);
        }


        
        private string sessionFactoryConfigPath;
        private ILogger logger;
    }
}
